const getStudentHomeworkByIdUrl = require('../../../../../config.js').getStudentHomeworkByIdUrl

Page({
  data: {
    content: '吴宇珩的家长：今天作业：语文：1.一张试卷。2.背答谢中书书翻译。数学：第14章检测题谢背面2.第十三章质量评估试卷写正面。最好都写完）。英语：1.练习册62页2.复习M1写错题本M1。3. 背M1练习册P61作文。4. 家长群接龙。政治： 背默第二课知识点（ 家长签字 + 抽背）。物理： 一张试卷， 复习。生物1.P27， 29 预习部分。 - 柳州市第八中学',
		navList:[
			{
				name:'文字',
				id:0
			},{
				name:'图片',
				id:1
			},
		],
		indicatorDots:true,
		autoplay: false,
		interval: 1000,
		duration: 300,
		tabIndex: 0
  },
  onLoad: function(options) {
    let that = this
    console.log(JSON.parse(options.studentId))
    let studentInfo = JSON.parse(options.studentId)
    wx.showLoading({
      title: '小五努力记载中...',
    })
    wx.getStorage({
      key: 'teacherInfo',
      success: function(res) {
        let teacherInfo = res.data
        console.log(teacherInfo)
      },
    })
    wx.request({
      url: getStudentHomeworkByIdUrl,
      method:'POST',
      data:{
        "homeworkType": "MATH",
        "studentId": studentInfo.studentId
      },
      success:function(res){
        wx.hideLoading()
        console.log(res)
        console.log(res.data)
        that.setData({
          studentInfo: studentInfo
        })
      }
    })
  },
  preImg:function(){
    wx.previewImage({
      current: 'https://gitee.com/RainWu/Corridor/raw/master/%E5%91%A8%E6%80%9D%E7%90%A6.jpg', // 当前显示图片的http链接
      urls: ['https://gitee.com/RainWu/Corridor/raw/master/WechatIMG7.jpeg'] // 需要预览的图片http链接列表
    })
  },
  comeback:function(){
    wx.navigateBack({
      
    })
  },
	// 重新开始
	tabNav(e){
		console.log(e.detail.current)
		let that = this;
		that.setData({
			tabIndex:e.detail.current
		})
	},
	// 点击切换文字 or 图片
	tabScreen(e){
		console.log(e.currentTarget.dataset.id)
		let that = this
		let id = e.currentTarget.dataset.id
		switch (id){
			case 0:
				that.setData({
					tabIndex:id
				})
			break;
			case 1:
				that.setData({
					tabIndex:id
				})
			break
		}
	}
})